package cn.tedu.api;
//测试 StringBuffer
public class Test3_StringBuffer {
    public static void main(String[] args) {
       method();
        //      method2();
    }
    public static void method2(){
        String s2 = "just do it ";
        StringBuffer sb = new StringBuffer();
        long start2 = System.currentTimeMillis();
        for (int i = 0; i <5 ; i++) {
            sb.append(s2);
        }
        long end2 = System.currentTimeMillis();
        System.out.println(end2-start2);
        System.out.println(sb.append(s2));
    }
    public static void method(){
        String s1= "just do it";
        String rem = "";
        long start1 = System.currentTimeMillis();
        for (int i = 0; i <5 ; i++) {
            rem=rem+s1;
        }
        long end1 = System.currentTimeMillis();
        System.out.println(end1-start1);
        System.out.println(rem);
    }
}

